﻿Imports Autodesk.AutoCAD.ApplicationServices
Public Class CLDS_Document_Data
#Region "Private declarations"
    Private _palette_visible As Boolean
    Private _conn_focus As String
    Private _network_draw_area As String
    Private _network_draw_segregation As String
    Private _network_draw_hilite_rs As Integer
    Private _network_draw_hilite_as As Integer
    Private _network_draw_hilite_fs As Integer
    Private _network_draw_hilite_ls As Integer
    Private _network_draw_hilite_ft As String
    Private _network_edit_area As String
    Private _network_edit_segregation As String
    Private _network_edit_nrtype As String
    Private _network_edit_pstype As String
    Private _network_edit_elevation As String
    Private _network_edit_raceway As String
    Private _network_edit_addtype As String
    Private _network_near_devid As String
    Private _segment_segid As String
    Private _segment_fromnode As String
    Private _segment_tonode As String
    Private _segment_tierno As Integer
    Private _route_cabid As String
#End Region
#Region "Public properties"
    Public ReadOnly Property IsVisible() As Boolean
        Get
            Return _palette_visible
        End Get
    End Property
#End Region
#Region "Public methods"
    Public Sub SaveParameters(ByVal p_doc As Document, ByVal p_conn As CLDS_Connection_Container, ByVal p_network As CLDS_Network_Container, ByVal p_segment As CLDS_Segment_Container, ByVal p_route As CLDS_Route_Container, ByVal p_visible As Boolean)
        _palette_visible = p_visible
        _conn_focus = p_conn.cbVFocus.Text
        _network_draw_area = p_network.cbFArea.Text
        _network_draw_segregation = p_network.cbFSeg.Text
        If p_network.cbShowRouted.Checked Then
            _network_draw_hilite_rs = 1
        Else
            _network_draw_hilite_rs = 0
        End If
        If p_network.cbShowApproved.Checked Then
            _network_draw_hilite_as = 1
        Else
            _network_draw_hilite_as = 0
        End If
        If p_network.cbShowFill.Checked Then
            _network_draw_hilite_fs = 1
        Else
            _network_draw_hilite_fs = 0
        End If
        If p_network.cbShowLock.Checked Then
            _network_draw_hilite_ls = 1
        Else
            _network_draw_hilite_ls = 0
        End If
        _network_draw_hilite_ft = p_network.tbHFill.Text
        _network_edit_area = p_network.cbDArea.Text
        _network_edit_segregation = p_network.cbDSeg.Text
        _network_edit_nrtype = p_network.cbDType.Text
        _network_edit_pstype = p_network.cbDPSType.Text
        _network_edit_elevation = p_network.tbDZ.Text
        _network_edit_raceway = p_network.tbDRWay.Text
        If p_network.rbAddNode.Checked Then
            _network_edit_addtype = 1
        ElseIf p_network.rbAddDevice.Checked Then
            _network_edit_addtype = 2
        ElseIf p_network.rbAddPS.Checked Then
            _network_edit_addtype = 4
        Else
            _network_edit_addtype = 0
        End If
        _network_near_devid = p_network.tbDevID.Text
        _segment_segid = p_segment.tbSegID.Text
        _segment_fromnode = p_segment.tbFromNode.Text
        _segment_tonode = p_segment.tbToNode.Text
        _segment_tierno = p_segment.TB
        _route_cabid = p_route.tbCabID.Text
    End Sub
    Public Sub RestoreParameters(ByVal p_conn As CLDS_Connection_Container, ByVal p_network As CLDS_Network_Container, ByVal p_segment As CLDS_Segment_Container, ByVal p_route As CLDS_Route_Container)
        p_conn.cbVFocus.Text = _conn_focus
        p_network.cbFArea.Text = _network_draw_area
        p_network.cbFSeg.Text = _network_draw_segregation
        If _network_draw_hilite_rs > 0 Then
            p_network.cbShowRouted.Checked = True
        Else
            p_network.cbShowRouted.Checked = False
        End If
        If _network_draw_hilite_as > 0 Then
            p_network.cbShowApproved.Checked = True
        Else
            p_network.cbShowApproved.Checked = False
        End If
        If _network_draw_hilite_fs > 0 Then
            p_network.cbShowFill.Checked = True
        Else
            p_network.cbShowFill.Checked = False
        End If
        If _network_draw_hilite_ls > 0 Then
            p_network.cbShowLock.Checked = True
        Else
            p_network.cbShowLock.Checked = False
        End If
        p_network.tbHFill.Text = _network_draw_hilite_ft
        p_network.cbDArea.Text = _network_edit_area
        p_network.cbDSeg.Text = _network_edit_segregation
        p_network.cbDType.Text = _network_edit_nrtype
        p_network.cbDPSType.Text = _network_edit_pstype
        p_network.tbDZ.Text = _network_edit_elevation
        p_network.tbDRWay.Text = _network_edit_raceway
        p_network.rbAddNode.Checked = False
        p_network.rbAddDevice.Checked = False
        p_network.rbAddPS.Checked = False
        If _network_edit_addtype = 1 Then
            p_network.rbAddNode.Checked = True
        ElseIf _network_edit_addtype = 2 Then
            p_network.rbAddDevice.Checked = True
        ElseIf _network_edit_addtype = 4 Then
            p_network.rbAddPS.Checked = True
        End If
        p_network.tbDevID.Text = _network_near_devid
        p_network.ShowDevice()
        p_segment.tbSegID.Text = _segment_segid
        p_segment.tbFromNode.Text = _segment_fromnode
        p_segment.tbToNode.Text = _segment_tonode
        Dim rb As RadioButton = p_segment.gbTiers.Controls("rbTier" + Trim(Str$(_segment_tierno)))
        rb.Checked = True
        p_segment.TB = _segment_tierno
        p_segment.ShowSegment()
        p_route.tbCabID.Text = _route_cabid
        p_route.ShowCable()
    End Sub
#End Region
End Class
